package com.olymtech.jbricks.dingtalk.message.delivery.request;

import com.olymtech.jbricks.dingtalk.message.Message;
import com.olymtech.jbricks.dingtalk.message.delivery.MessageDelivery;
import com.olymtech.jbricks.dingtalk.message.delivery.MessageDeliveryType;
import com.taobao.api.BaseTaobaoRequest;

/**
 * @author haoting.wang
 * @date 2020/12/10 4:31 下午
 **/
public class TaobaoRequestFactory {

    public static BaseTaobaoRequest buildTaobaoRequest(MessageDelivery messageDelivery, Message message) {

        if (MessageDeliveryType.WORK.equals(messageDelivery.type())) {
            return new WorkTaobaoRequest(messageDelivery, message).build();
        }

        if (MessageDeliveryType.CHAT.equals(messageDelivery.type())) {
            return new ChatTaobaoRequest(messageDelivery, message).build();
        }

        return null;
    }
}
